/*
 * TODO
 */
package com.xtrip.common;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import com.xtrip.util.exception.WebServiceException;

/**
 * @project xtrip
 * @author shiming.yao
 * @time 2013-5-30
 */
public class InitFunctions {
	public static String readTemplateCtrip() throws Exception {
		BufferedReader bufferedReader = null;
		try {
			bufferedReader = new BufferedReader(new FileReader(
					"E:\\bank\\xtrip\\src\\RequestSOAPTemplate.xml"));
			String text = bufferedReader.readLine();
			StringBuilder soapShellStringBuilder = new StringBuilder();
			while (text != null) {
				soapShellStringBuilder.append(text);
				text = bufferedReader.readLine();
			}
			String result = soapShellStringBuilder.toString();
			return result;
		} catch (FileNotFoundException e) {
			throw new WebServiceException("无法找到请求模板文件");
		} catch (IOException e) {
			throw new WebServiceException("无法读取请求模板文件");
		} finally {
			if (bufferedReader != null) {
				try {
					bufferedReader.close();
				} catch (IOException e) {
				}
			}
		}
	}
	public static String readTemplateElong() throws Exception {
		BufferedReader bufferedReader = null;
		try {
			bufferedReader = new BufferedReader(new FileReader(
					"E:\\bank\\xtrip\\src\\RequestSOAPTemplate.xml"));
			String text = bufferedReader.readLine();
			StringBuilder soapShellStringBuilder = new StringBuilder();
			while (text != null) {
				soapShellStringBuilder.append(text);
				text = bufferedReader.readLine();
			}
			String result = soapShellStringBuilder.toString();
			return result;
		} catch (FileNotFoundException e) {
			throw new WebServiceException("无法找到请求模板文件");
		} catch (IOException e) {
			throw new WebServiceException("无法读取请求模板文件");
		} finally {
			if (bufferedReader != null) {
				try {
					bufferedReader.close();
				} catch (IOException e) {
				}
			}
		}
	}
}
